<?
require_once("dbconnect.php");
require_once("admin_functions.php");
require_once("classes/mail.php");

chk_session();
//pagination code start here
if(!isset($_REQUEST['dir'])){
        $dir = "DESC";
} else {
        $dir = $_REQUEST['dir'];
}

if ($_REQUEST['b'] == ""){ $b=0; } else { $b = $_REQUEST['b'];} 
//pagination code ends here


if($_GET['action'] == "SATISFIED")
{
	$query_data = "Update customer set status='S' where customer_id=".$_REQUEST['cuid'];
	$result_update	= mysql_query ( $query_data ) or die(mysql_error());
}

if($_GET['action'] == "CANCEL")
{
	$query_data = "Update customer set paid='N' where customer_id=".$_REQUEST['cuid'];
	$result_update	= mysql_query ( $query_data ) or die(mysql_error());
}


		$sql = "SELECT customer.customer_id,customer.name, customer.feetInch, customer.age, occupation.occupation, country.country, nativeplace.nativeplace, customer.expectation, customer.image_1 FROM (((customer INNER JOIN country ON customer.country = country.country_id) INNER JOIN state ON customer.state = state.state_id) INNER JOIN nativeplace ON customer.city = nativeplace.nativeplace_id) INNER JOIN occupation ON customer.occupation = occupation.occupation_id WHERE status = 'Y' and paid = 'Y'";
		
				$rs = mysql_query($sql) or die(mysql_error());
				$cnt = mysql_num_rows($rs);
                $sql .= " ORDER BY customer.customer_id DESC LIMIT $b, $pagecount_1";
                $rs = mysql_query($sql) or die(mysql_error());
			
?>

<?php require_once('include/header.php'); ?>

  
  
  
      <div id="middle_container_for_innerpage">
      <div id="innerpage_top_image"><img src="images/images/innerpage_top_corner_820x5.jpg"  height="5" /></div> 
      <div id="middle_inner_container">
      <?php require_once('include/left_side_menu.php'); ?>
	          
        <div id="inner_page_middle_data">
        
          <div id="page_heading">Approve for Paid Customer </div>
          <?
        if(@mysql_num_rows($rs)>0){
                                ?>
        <div id="below_page_heading_text"><p><strong>Total number of Profile <?php echo $b; ?> to <?php echo $pagecount_1+ $b; ?> out of <?php echo $cnt; ?></strong></p>
        </div><? while($row=mysql_fetch_array($rs)){ ?>
        <div id="advanced_search_profile" onmouseover="myBG(this,'#F8FCFD')" onmouseout="myBG(this,'')">
        	<div align="center" id="customer_image"><?if($row['image_1']){?><a href="../profile.php?cid=<?php echo $row['customer_id']; ?>"><img src="../uploaded/thumb/<?=$row['image_1']?>"  border="0" class="image_border"></a>
                  <?}else{?>
                <a href="../profile.php?cid=<?php echo $row['customer_id']; ?>"><img src="../uploaded/thumb/default.jpg" width="80" height="80" border="0" class="image_border" ></a>                <?}?></div>
            <div id="customer_data"  style="width:357px;">
            	<div id="profile_id" style="width:350px;">
                	<div id="profile_id_text"><a href="../profile.php?cid=<?php echo $row['customer_id']; ?>" >Profile ID: <?php echo $row['customer_id']; ?></a></div>
                    <div id="online_offline_icons">
                    	<div id="small_icon"><img src="images/images/status_online.png" alt="Online" title="Online" width="16" height="16" /></div>
                        <div id="small_icon"><img src="images/images/status_online.png" alt="Offline" title="Online" width="16" height="16" /></div>
                    </div>
                </div>
                <div id="brief_profile" style="width:350px;"><a href="../profile.php?cid=<?php echo $row['customer_id']; ?>"><?php echo $row['name']; ?></a>, <?php echo $row['age']; ?>, <?php echo $row['feetInch']; ?> Inch., <?php echo $row['occupation']; ?>, <?php echo $row['nativeplace']; ?></div>
                <div id="brief_expectations" style="width:350px; height:37px;"><?=stripslashes(substr($row['expectation'],0,200)) ?> 
                <a href="../profile.php?cid=<?php echo $row['customer_id']; ?>">more...</a></div>
                <div id="last_online" style="width:350px;"><div id="small_icon"><img src="images/images/icon_user.gif" alt="Last Onlie" width="16" height="16" /></div><span class="green">Last online:</span> <?= $row['dton'] ? "" : "12-Febuary-2008" ?><?php echo $row['dton']; ?></div>
          <div id="details_link" style="width:350px;">
                	<div id="icon_and_text_container">
                        <div id="small_icon"><a href="send_message.php?send_to=<?php echo $row['customer_id']; ?>"><img src="images/images/icon_18x18.gif" width="18" height="18" border="0" alt="Send Message" title="Send Message" /></a></div>
                      	<div id="icon_text"><a href="../send_message.php?send_to=<?php echo $row['customer_id']; ?>">Send Message</a></div> |                    </div>
                    <div id="icon_and_text_container">
                        <div id="small_icon"><a href="profile.php?cid=<?php echo $row['customer_id']; ?>"><img src="images/images/action_go.gif" width="16" height="16" border="0" alt="Send Message" title="Send Message" /></a></div>
                      <div id="icon_text"><a href="../profile.php?cid=<?php echo $row['customer_id']; ?>">Details...</a></div>
                  </div>
              </div>
            </div>
			<div id="for_admin"><a href="JavaScript:if(confirm('Are you sure you want to make Satisfied this Customer?')){self.location.href='paid_stat.php?cuid= <?php echo $row['customer_id']; ?>&action=SATISFIED';}"
							class="link-normal">Satisfied</a>&nbsp;| <a href="JavaScript:if(confirm('Are you sure you want to unpaid Customer?')){self.location.href='paid_stat.php?cuid=<?php echo $row['customer_id']; ?>&action=CANCEL';}"
							class="link-normal">Unpaid</a></div>
        </div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
        <? }

        } else { ?><div id="no_results_message">Sorry!! No results found.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div><? } ?>
		<? if ($cnt > $pagecount_1) {?>
        <div id="search_pages"><div id="search_pages_text">&nbsp;</div> <?
                                                $qrystr="&sortBy=$sortBy&dir=$dir&gender=".$_REQUEST['gender']."&age_min=".$_REQUEST['age_min']."&age_max=".$_REQUEST['age_max']."&country=".$_REQUEST['country']."&city=".$_REQUEST['city']."&marital_status=".$_REQUEST['marital_status']."&feetInch=".$_REQUEST['feetInch']."&weightKg=".$_REQUEST['weightKg']."&degree=".$_REQUEST['degree']."&occupation=".$_REQUEST['occupation']."&mothertongue=".$_REQUEST['mothertongue'];
                                                displayPageNo($b,$cnt,$qrystr,"link-pagination",$pagecount_1);
                                        ?> </div></div> <? } ?>

        
        

       
       
      </div>
     
      <div id="corner_container_bottom_for_innerpage"><img src="images/images/innerpage_bottom_corner_820x10.jpg"  height="10" /></div>
    </div> 
      <!-- middle_container ends -->
<?php require_once('include/footer.php'); ?>
